package com.bussiness;

public class MovieBussinessProxy implements com.bussiness.MovieBussiness {
  private String _endpoint = null;
  private com.bussiness.MovieBussiness movieBussiness = null;
  
  public MovieBussinessProxy() {
    _initMovieBussinessProxy();
  }
  
  public MovieBussinessProxy(String endpoint) {
    _endpoint = endpoint;
    _initMovieBussinessProxy();
  }
  
  private void _initMovieBussinessProxy() {
    try {
      movieBussiness = (new com.bussiness.MovieBussinessServiceLocator()).getMovieBussiness();
      if (movieBussiness != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)movieBussiness)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)movieBussiness)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (movieBussiness != null)
      ((javax.xml.rpc.Stub)movieBussiness)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public com.bussiness.MovieBussiness getMovieBussiness() {
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness;
  }
  
  public int[] getAllCatIds() throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.getAllCatIds();
  }
  
  public java.lang.String getCategoryName(int categoryId) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.getCategoryName(categoryId);
  }
  
  public com.beans.Movie[] getAllMovies() throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.getAllMovies();
  }
  
  public com.beans.Movie[] getMoviesbyCategory(int categoryId) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.getMoviesbyCategory(categoryId);
  }
  
  public int createMovie(com.beans.Movie addMovie) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException, com.exceptions.MovieAlreadyExistsException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.createMovie(addMovie);
  }
  
  public int updateMovie(com.beans.Movie editMovie) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.updateMovie(editMovie);
  }
  
  public int deleteMovie(com.beans.Movie removeMovie) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.deleteMovie(removeMovie);
  }
  
  public int issueMovie(com.beans.Movie movie, com.beans.Person user) throws java.rmi.RemoteException, com.exceptions.MovieUnavailableException, com.exceptions.ServiceUnavailableException, com.exceptions.UserNotEligibleException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.issueMovie(movie, user);
  }
  
  public int submitMovie(com.beans.Movie movie, com.beans.Person user) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.submitMovie(movie, user);
  }
  
  public com.beans.Person generateBill(com.beans.Person user) throws java.rmi.RemoteException, com.exceptions.ServiceUnavailableException{
    if (movieBussiness == null)
      _initMovieBussinessProxy();
    return movieBussiness.generateBill(user);
  }
  
  
}